package com.code.softeem.jc;

public class Dog extends Animal{
    private String type;

    public Dog(){
        //调用父类的无参构造函数
        super();
    }

    public Dog(String type){
        this.type = type;
    }

    public Dog(String name,String sex,int age,String type){
        //调用类父类中的有参构造函数,使用super关键字加参数的形式来实现给
        //父类的构造函数进行赋值使用
        super(name,sex,age);
        this.type = type;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Override
    public String toString() {
        return "Dog{" +
                "name=" + getName() +
                ", sex='" + getSex() + '\'' +
                ", age=" + getAge() +
                "type='" + type + '\'' +
                '}';
    }

    public void eat(){
        System.out.println("狗吃骨头");
    }

    public void eat(String name,int age,String type){
        System.out.println(name + "今年" + age + "岁,是一只" + type + "喜欢吃骨头");
    }
}
